{extend name="template/base" /}
{block name="content"}
<div class="page-container">
<style>.btn{margin-top:3px; border:none;}</style>
	<input type="hidden" id="cat_id" name="id" value="{$Request.param.cat_id ?? ''}">
    <div class="cl pd-5 bg-1 bk-gray">
        <span class="l">
		{tp:menu menu="add" /}
		{tp:menu menu="forbid,delete" /}
        </span>
        <span class="r pt-5 pr-5">
            共有数据 ：<strong>{$count ?? '0'}</strong> 条
        </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            {include file="th" /}
            <th width="150">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            {include file="td" /}
            <td class="f-14">
                {$vo.status|show_status=$vo.id}
                {tp:menu menu='sedit' /}
                {tp:menu menu='sdelete' /}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page ?? ''}</div>
</div>
{/block}
{block name="script"}
<script>
    $(function () {
		var cid=$("#cat_id").val();
		if(cid!=""&&cid!=null)
			$(".cat_id").val(cid);
		
    });
	function main(id,m){
			if(m==0)
			{
				var text="取消重点";
				m=1;
				var color="red";
			}
			else if(m==1)
			{
			    var text="设为重点";
				m=0;
				var color="#333";
			}
			$.ajax({
				data:{'id':id,'main':m},
				type: "post",
				url: "{:Url('Article/change_main')}",
				dataType:'json', 
				beforeSend: function(XMLHttpRequest){
				},
				success: function(data, textStatus){
					$("#main_"+id).text(text);
					$("#main_"+id).css('color',color);
				}
			});
	}
	function sh(id,sh){
			if(sh==0)
			{
				
				var text="取消通过";
				sh=1;
				var color="red";
			}
			else if(sh==1)
			{
				
				var text="通过审核";
				sh=0;
				var color="#333";
			}
			$.ajax({
				data:{'id':id,'sh':sh},
				type: "post",
				url: "{:Url('Article/change_sh')}",
				dataType:'json', 
				beforeSend: function(XMLHttpRequest){
				},
				success: function(data, textStatus){
					$("#main_"+id).text(text);
					$("#main_"+id).css('color',color);
				}
			});
		}
</script>
{/block}

